package org.FaPe3D.engine.quality
{
	import flash.display.Stage;
	import flash.display.StageQuality;
	
	import org.FaPe3D.Adapter;
	
	public class Quality
	{
		private static var _stage:Stage; 
		
		public function Quality()
		{
		}
		
		public static function FPQuality(start:Boolean = true):void
		{
			if(Adapter.getCurrentAdapter().viewports != null)
			{	
				if(Adapter.getCurrentAdapter().settings.setting['property.moveQuality'])
				{
					if(start)
					{
						setQuality(StageQuality.LOW);
					}else
					{
						setQuality(StageQuality.HIGH);
					}
				}
			}
		}
		
		public static function setQuality(level:String = 'HIGH'):void
		{
			if(_stage == null && Adapter.currentAddapterID != null && Adapter.getCurrentAdapter().viewports.getDefaultViewport().stage != null && Adapter.getCurrentAdapter().viewports != null)
			{
				_stage = Adapter.getCurrentAdapter().viewports.getDefaultViewport().stage;
			}else
			{
				_stage = null;
			}
			//
			if(_stage != null)
			{
				switch(level)
				{
					case StageQuality.BEST : 
						_stage.quality = StageQuality.BEST;
					break;
					
					case StageQuality.HIGH : 
						_stage.quality = StageQuality.HIGH;
					break;
					
					case StageQuality.LOW : 
						_stage.quality = StageQuality.LOW;
					break;
					
					case StageQuality.MEDIUM : 
						_stage.quality = StageQuality.MEDIUM;
					break;
					
					default : 
						_stage.quality = StageQuality.HIGH;
					break;
				}
			}
		}

	}
}